<template>
  <div class="home">这是获取vuex数据的第二种方法:{{ sum1 }}</div>
  <button @click="jian(2)" style="marginRight:10px">--</button>
  <button @click="jian1(2)">两秒后减2</button>
</template>

<script>
import { mapState, mapMutations, mapActions } from "vuex";

export default {
  computed: {
    ...mapState('jianfa',["sum1"]),
  },
  methods: {
    ...mapMutations('jianfa',["subtraction"]),
    ...mapActions('jianfa',["asynjian"]),
    jian(value) {
      this.subtraction(value);
    },
    jian1(value) {
      this.asynjian(value);
    },
  },
};
</script>
